import 'package:flutter/material.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app/utils/windowUtil.dart';
import 'dart:async';
import 'MainWidget.dart';
import 'MainWidget1.dart';
import 'Login.dart';
import 'dart:ui';
class SplashWidget1 extends StatefulWidget {
  @override
  State<SplashWidget1> createState() => _SplashWidget1State();
}

class _SplashWidget1State extends State<SplashWidget1> {
  int count=1;
  Timer timerPeriod;
  @override
  void initState() {
    super.initState();
    timerPeriod= Timer.periodic(new Duration(seconds: 1), (timer){
      if(count==0){
//        Navigator.pushAndRemoveUntil(context,new MaterialPageRoute(builder: (c){
//          return new MainWidget();
//        }),null);
//        timerPeriod.cancel();

        Navigator.pushReplacement(context, new MaterialPageRoute(builder: (c){
          return new Login();
        }));
        return;
      }
      count--;
      setState(() {

      });
    });
  }

  @override
  Widget build(BuildContext context) {
    windowUtil.height=MediaQuery.of(context).size.height;
    windowUtil.width=MediaQuery.of(context).size.width;
    windowUtil.statusbar=MediaQueryData.fromWindow(window).padding.top;

    return Scaffold(

      body: new Container(
//        child: Image.asset("images/img.jpg",fit: BoxFit.fill,height: windowUtil.height,),
          child: Stack(

            children: <Widget>[
              Image.asset("images/startpage1.png",fit: BoxFit.fill,height: windowUtil.height,width: windowUtil.width,),

//              Positioned(//child:
////              Container(child: Center(child: Text('$count',style: TextStyle(fontWeight: FontWeight.bold),),),
////                decoration: BoxDecoration(color: Colors.yellow ,shape: BoxShape.circle),
////                width: 30.0,height: 30.0,
////              ),right: 20.0,top: 20.0,
//              )


            ],

          )
      ),

    );
  }
}